import { Modal } from 'antd'
import { useState, forwardRef, useImperativeHandle, ForwardRefRenderFunction } from 'react'
import LinkAdd from '../linksAdd/linksAdd'
const LinkModal: ForwardRefRenderFunction<{}, { getLinkList: () => void }> = ({ getLinkList }, ref) => {
  const [isModalVisible, setIsModalVisible] = useState<boolean>(false)
  const handleCancel = () => {
    setIsModalVisible(false)
  }
  const submit = () => {
    console.log('submit')
  }
  useImperativeHandle(ref, () => ({
    setIsModalVisible
  }))

  return (
    <div>
      <Modal title="编辑" style={{ top: 20 }} width={1000} visible={isModalVisible} footer={null} onOk={submit} onCancel={handleCancel}>
        <LinkAdd closeModal={handleCancel} getLinkList={getLinkList}></LinkAdd>
      </Modal>
    </div>
  )
}

export default forwardRef(LinkModal)
